/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

$( function() {
    $("#crop-layer").draggable({
  containment: "parent"
}).resizable();
  } );
  

$( function() {
    $("#buttonCrop").click(function() {
        var position = $("#crop-layer").position();
        var width = $("#crop-layer").width();
        var height = $("#crop-layer").height();
        $( "#x" ).val( position.left );
        $( "#y" ).val( position.top );
        $( "#width" ).val( width );
        $( "#height" ).val( height );
    });
} );

$(function() {
    $("#user_name").blur(function() {
        var name = $(this).val();
        $.ajax({
            url: "http://localhost/pruebaCodeIgniter/index.php/controller/check_login",
            data: 'user_name='+name,
            type: "POST",
            success: function(data) {
                if(data == true) {
                    alert("Es true");
                    $("#user_name").css("background-color", "red");
                }
                else alert("Es falso");
            }
        });
    });
});